﻿<!DOCTYPE html>
<html>
<head>
    <title>济南希望儿童康复中心</title>
    <meta charset="utf-8" />
    <link rel="icon" href="/favico.ico" type="/image/x-icon" />
    <link rel="shortcut icon" href="/favico.ico" type="/image/x-icon" />

    <!--Import materialize.css-->
    <link type="text/css" rel="stylesheet" href="content/materialize-v0.97.0/css/materialize.min.css" media="screen,projection" />
    <link href="content/materialize-v0.97.0/css/icon.css" rel="stylesheet">

    <!--Let browser know website is optimized for mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body ng-app ="hhApp">
    <!--Import jQuery before materialize.js-->
    <script type="text/javascript" src="content/jquery/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="content/angular-v1.4.1/angular.min.js"></script>
    <script type="text/javascript" src="content/angular-v1.4.1/angular-route.min.js"></script>
    <script type="text/javascript" src="content/materialize-v0.97.0/js/materialize.min.js"></script>
    <script type="text/javascript" src="res/js/hh.js"></script>
    <ng-include src="'templates/header.html'"></ng-include>  
    <div ng-view>
    </div>
    <ng-include src="'templates/footer.html'"></ng-include>  
    <script>
        var app = angular.module("hhApp", ['ngRoute']);
        app.config(['$controllerProvider', '$routeProvider', function ($controllerProvider, $routeProvider) {
            app.register = {
                controller: $controllerProvider.register
            };

            $routeProvider
                .when('/home', {
                    templateUrl: '/views/home.html',
                    controller: 'ALController'
                })
                .when('/admission', {
                    templateUrl: '/views/admission.html'
                })
                .when('/contact', {
                    templateUrl: '/views/contact.html'
                })
                .when('/donate', {
                    templateUrl: '/views/donate.html'
                })
                .when('/course', {
                    templateUrl: '/views/course.html'
                })
               .otherwise({
                   redirectTo: '/home'
               });
        }]);
        app.controller("ALController", function ($scope, $http) {
            $scope.visible = true;
            $scope.Message = "加载中...";
            $http({
                url: 'api.ashx?sys:mod=cms&sys:sno=article&sys:act=getTop10'
            }).success(function (result, status) {
                //$scope.status = status;
                $scope.Articles = result.data.items;
                $scope.visible = false;
            }).error(function (result, status) {
                //$scope.data = data || "Request failed";
                $scope.Message = "加载出错";
            });
        });

        app.controller("navController", function ($scope, $location) {
            $scope.isActive = function (route) {
                return route == $location.path();
            }
        });

        //app.controller("pController", function ($scope, $http) {
        //    $scope.message = 'Contact us! JK. This is just a demo.';
        //});
    </script>
</body>
</html>
